﻿namespace OOP
{
    using System;

    public class MainDeclaringClasses
    {
        private static void Main()
        {
            GSMTest.GSMCasualTest(); // empty gsm and casual case (nokia)

            GSMTest.IPhoneTest();

            Call asdd = new Call("+359822123456");
            Console.WriteLine(asdd.DateAndTime);
            Console.WriteLine(asdd.PhoneNumber);

            asdd.EndCall();
            Console.WriteLine(asdd.Duration);

            Console.WriteLine(new string('-', 20));

            GSM testyGSM = new GSM();
            testyGSM.AddCall(new Call("+3598888"));
            testyGSM.AddCall(new Call("+213123"));

            foreach (var call in testyGSM.CallHistory)
            {
                Console.WriteLine(call);
            }

            Console.WriteLine("{0:C2}", testyGSM.TotalPrice(0.37f));

            int longestCall = int.MinValue;
            int indexOfLongest = 0;

            for (int i = 0; i < testyGSM.CallHistory.Count; i++)
            {
                if (testyGSM.CallHistory[i].Duration > longestCall)
                {
                    longestCall = testyGSM.CallHistory[i].Duration;
                    indexOfLongest = i;
                }
            }

            testyGSM.RemoveCall(indexOfLongest);

            Console.WriteLine("{0:C2}", testyGSM.TotalPrice(0.37f));

            testyGSM.ClearCallHistory();

            foreach (var call in testyGSM.CallHistory)
            {
                Console.WriteLine(call);
            }
        }
    }
}